<template>
  <div class="block">
    <span @click="setday" class="demonstration">今天</span>
    <el-date-picker
      v-model="value2"
      type="daterange"
      start-placeholder="开始时间"
      end-placeholder="结束时间"
    />
  </div>
</template>

<script lang="ts" setup>
import { ref,watch } from 'vue'
import dayjs from 'dayjs';
const value2:any = ref('')

watch(value2,(val1,val2)=>{
  console.log(val2);
})

const setday =()=>{
  const time = dayjs().format("YYYY-MM-DD");
  console.log(time);
  value2.value= [time, time];
}
</script>
<style scoped>
.block {
  padding: 30px 0;
  text-align: center;
  border-right: solid 1px var(--el-border-color);
  flex: 1;
}
.block:last-child {
  border-right: none;
}
.block .demonstration {
  display: block;
  color: var(--el-text-color-secondary);
  font-size: 14px;
  margin-bottom: 20px;
  cursor: pointer;
}
</style>